using System;
using System.Collections.Generic;
using System.Text;
using ObjectModel;
using System.Configuration;

namespace Client
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Runtime.Remoting.RemotingConfiguration.Configure("client.exe.config", false);

            Proxy.Start("tcp://localhost:7777/backend.rem");

            /*
             * use Http
             * Proxy.Start("http://localhost:7778/backend.rem");
             * 
             */


            Console.WriteLine("Connection established.");

            OrderCollection orders = new OrderCollection();
            int idx = orders.LoadById(10248); // just an existing OrderID

            Order order = orders[idx];
            Console.WriteLine("Order id:" + order.Id.ToString());
            Console.WriteLine("Order date: " + order.OrderDate.ToString());
            Console.WriteLine("Employee id:" + order.Employee.Id.ToString());
            Console.WriteLine("Employee name: " + order.Employee.FirstName);

            // we experience lazy loading here...
            int employeeOrders = order.Employee.Orders.Count;
            Console.WriteLine("Employee orders#: " + employeeOrders.ToString());

            Console.WriteLine("Enter to close.");
            Console.ReadLine();

                    //<channel ref="http" port="0" displayName="Ramsys Client Channel">
        }
    }
}
